<?php
/**
* 按Json方式输出通信数据
*/
class Json extends Api
{
	/**
	 * json
	 * @param  int $code    [description]
	 * @param  string $message [description]
	 * @param  array  $data    [description]
	 * @return string          [description]
	 */
	public function response($code, $message = '', $data = array())
	{
		if (!(is_numeric($code))) {
			return '';
		}
		$result = array(
			'code' => $code,
			'message' => $message,
			'data' => $data
		);
		echo json_encode($result);
		exit();
	}
}